<template>
    <div class="container" @click="handelCloseClick" v-show="showImg">
      <div class="wrapper">
        <swiper :options="galleryOption" >
          <swiper-slide v-for= "(item,index) of imgs" :key="index">
            <img :src="item" alt="" class="gallery-img">
          </swiper-slide>
          <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
      </div>
    </div>
</template>

<script>
export default {
  name: 'Gallery',
  props: {
    imgs: {
      type: Array
    }
  },
  data() {
    return {
      showImg: false,
      galleryOption: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observer: true,
        observeParents: true
      }
    }
  },
  methods: {
    handelCloseClick() {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .container >>> .swiper-container
    overflow inherit
  .container
    position fixed
    z-index 99
    top 0
    left 0
    right 0
    bottom 0
    background #000
    display flex
    flex-direction column
    justify-content center
    .wrapper
      width 100%
      width 100%
      .gallery-img
        width 100%
      .swiper-pagination
        color #ffffff
        position absolute
        bottom -1rem
</style>
